#!/usr/bin/env python
# -*- coding:utf-8 -*-
import logging

logging.basicConfig(level=logging.INFO)  # debug，info，warning，error


class FooError(StandardError):
    pass


def foo(s):
    n = int(s)
    if n == 0:
        raise FooError('invalid value: %s' % s)
    return 10 / n


def bar(s):
    try:
        return foo(s) * 2
    except StandardError, e:
        print 'Error!'
        raise  # 捕获之后，原样抛出


if __name__ == '__main__':
    s = '0'
    n = int(s)
    logging.info('n = %d' % n)
    print 10 / n
